#%RAML 1.0
title: Material Types API
version: v2.2
protocols: [ HTTP, HTTPS ]
baseUri: http://localhost

documentation:
  - title: Material Types API
    content: This documents the API calls that can be made to query and manage material types of the system

types:
  mtype: !include materialtype.json
  mtypes: !include materialtypes.json
  errors: !include raml-util/schemas/errors.schema

traits:
  pageable: !include raml-util/traits/pageable.raml
  searchable: !include raml-util/traits/searchable.raml
  language: !include raml-util/traits/language.raml
  validate: !include raml-util/traits/validation.raml

resourceTypes:
  collection: !include raml-util/rtypes/collection.raml
  collection-item: !include raml-util/rtypes/item-collection.raml

/material-types:
  type:
    collection:
      exampleCollection: !include examples/materialtypes.json
      exampleItem: !include examples/materialtype.json
      schemaCollection: mtypes
      schemaItem: mtype
  get:
    is: [
      searchable: {description: "with valid searchable fields", example: "name=aaa"},
      pageable
    ]
    description: Return a list of material types
  post:
    description: Create a new material type
    is: [validate]
  delete:
    description: "Delete all material types"
    is: [language]
    responses:
      204:
        description: "All material types deleted"
      500:
        description: "Internal server error, e.g. due to misconfiguration"
        body:
          text/plain:
            example: "Internal server error, contact administrator"
  /{materialtypeId}:
    description: Pass in the MT code
    type:
      collection-item:
        exampleItem: !include examples/materialtype.json
        schema: mtype

